package cn.wolfcode.p2p.mgrsite;

import cn.wolfcode.p2p.CoreConfig;
import cn.wolfcode.p2p.mgrsite.shiro.ShiroConfig;
import cn.wolfcode.p2p.mgrsite.web.interceptor.CheckLoginInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@Import({CoreConfig.class, ShiroConfig.class})
@PropertySource("classpath:application-mgrsite.properties")
@EnableScheduling // 启用spring的定时任务
public class MgrSiteApplication implements WebMvcConfigurer {

    // 配置登录拦截器
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CheckLoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }

    public static void main(String[] args ) {
        SpringApplication.run(MgrSiteApplication.class, args);
    }
}



